<template>
    <el-table :data="tableChild" v-loading="loadingChild" :show-header='true' style="width: 100%">
         <el-table-column width="109">
            <template>
                <span></span>
            </template>
        </el-table-column>
        <el-table-column label="分类" width="120">
            <template scope="scope">
                <span>{{scope.row.sIncrementName}}</span>
            </template>
        </el-table-column>
        <el-table-column label="订单量（条）">
            <template scope="scope">
                <span>{{scope.row.totalNum | isNull}} （会员打包订单量：{{scope.row.vipTotalNum?scope.row.vipTotalNum:'0'}}）</span>
            </template>
        </el-table-column>
        <el-table-column label="销售额（元）">
            <template scope="scope">
                <span>{{Number(scope.row.totalMoney).toFixed(2) | isNull}} （会员打包销售额：{{Number(scope.row.vipTotalMoney).toFixed(2) | isNull}}）</span>
            </template>
        </el-table-column>
        <el-table-column label="经销商分成总额（元）">
            <template scope="scope">
                <span>{{Number(scope.row.dividedMoney).toFixed(2) | isNull}} （经销商打包分成总额：{{Number(scope.row.vipDividedMoney).toFixed(2) | isNull}}）</span>
            </template>
        </el-table-column>
        <el-table-column label="e学云后台分成总额（元）">
            <template scope="scope">
                <span>{{Number(scope.row.orgMoney).toFixed(2) | isNull}} （e学云打包分成总额：{{Number(scope.row.vipOrgMoney).toFixed(2) | isNull}}）</span>
            </template>
        </el-table-column>
    </el-table>  
</template>
<script>
    import { getAgentStatistics } from 'api/serviceManage';
    export default {
        name: 'childTable',
        props: {
            scope: Object,  // $index/row/store  你可以看scope 这个对象，这个页面有很多简化的 
            childData: Object
        },
        data() {
            return { 
                loadingChild: false,
                tableChild: []
            }
        },
        mounted() {
            // scope.row 可以获取这个row的信息比如id什么的,
            // 异步获取数据 赋值给 resourceC 即可
            let orgUserId = this.scope.row.orgUserId; // 经销商id
            let dateType = this.childData.dateType; // 0：选择天查询  1：选择月查询
            let date = this.childData.date; // 查询日期或查询的月份，如2017-10-31或2017-10     
            this.loadingChild = true;
            getAgentStatistics(orgUserId, dateType, date).then(res => {
                this.loadingChild = false;
                this.tableChild = res.data.content;
            }).catch(() => {
                this.loadingChild = false;
            });
        }
    }

</script>


